package com.qf.mrboot.controller;

import com.qf.mrboot.entity.Pic;
import com.qf.mrboot.result.ResponseData;
import com.qf.mrboot.service.PicService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Pic)表控制层
 *
 * @author makejava
 * @since 2021-05-26 10:25:07
 */
@Api(value="PicAPI")
@RestController
@RequestMapping("pic")
public class PicController {
    /**
     * 服务对象
     */
    @Resource
    private PicService picService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     * */

    @ApiOperation(value ="selectOne",notes = "通过图片id获取到对应的图片信息")
    @ApiImplicitParam(name="id",value="图片的id",dataType = "int")
    @GetMapping("selectOne")
    public Pic selectOne(Integer id) {
        return this.picService.queryById(id);
    }

    /**.
     *
     * @param type
     * @return
     */
    @ApiOperation(value="queryByType",notes = "通过图片的类型获取对应图片列表")
    @ApiImplicitParam(name="type",value = "图片类型")
    @GetMapping("queryByType/{type}")
    public ResponseData queryPicByType(@PathVariable String type){
        return picService.queryByType(type);
    }
}
